import axios from 'axios'

let instance = axios.create();
instance.defaults.baseURL = process.env.NODE_ENV === 'production' ? 'http://192.168.1.113:8080' : 'http://192.168.1.106:8080';
instance.defaults.timeout = 10000;
// instance.defaults.baseURL = process.env.NODE_ENV === 'production' ? 'http://47.100.240.34:8091' : 'http://192.168.1.113:8080';
instance.defaults.headers = {"Content-Type" : "application/x-www-form-urlencoded"};

instance.interceptors.request.use((config)=>{
    return config;
},err=>{
    return Promise.reject(err);
});

instance.interceptors.response.use(( response ) => {
    // 对响应数据做点什么
    return response;
}, ( error ) => {
    // 对响应错误做点什么
    return Promise.reject(error);
});

export default instance;